import java.util.Scanner;

/*
    评委打分
   6个人分数,去最大去最小,剩下四个求平均
 */
public class JudgeScore {
    public static void main(String[] args) {
        int num = 6;
        int[] score = new int[num];
        int i,maxId = 0,minId = 0;
        int sum = 0,average,max,min;

        Scanner sc = new Scanner(System.in);
        System.out.println("请输入"+num+"个数字");

        for(i = 0;i < score.length;i++){
            score[i] = sc.nextInt();
        }

        for(i = 0;i < score.length;i++){
            sum += score[i];
            if (score[i] > score[maxId]){
                maxId = i;
            }else if(score[i] < score[minId]){
                minId = i;
                //System.out.println(minId);
            }
        }

        max = score[maxId];
        min = score[minId];

        average = (sum - max - min) / (num - 2);
        System.out.println("去掉最大"+ max + ",去掉最小" +min);
        System.out.println("最后得分为:" + average);
    }
}
